|
|
|
|
|
|
|
m_CheckConditional = .ReadProperty("CheckConditional",
m_def_CheckConditional)
'
Text1.Text = .ReadProperty("Text", UserControl.Name)
End With
'
End Sub |
|
|
|
|
|
|
|
|
After adding the property methods, you need to add the CheckRequired method. Use the Tools | Add Procedure menu option to add a Public Sub called CheckRequired and enter the code from Listing 5.44. |
|
|
|
|
|
|
|
|
Listing 5.44. Coding the CheckRequired method. |
|
|
|
|
|
|
|
|
Public Sub CheckRequired()
'
If m_Required = True And Len(Trim(Text1.Text)) = 0 Then
RaiseEvent RequiredError
End If
'
End Sub |
|
|
|
|
|
|
|
|
Then you can add the Public Sub ConditionalValidate routine and copy the code from Listing 5.45 to your project. |
|
|
|
|
|
|
|
|
Listing 5.45. Coding the ConditionalValidate method. |
|
|
|
|
|
|
|
|
Public Sub ConditionalValidate(MasterName As String, ChildName As String,
ChildValue As Variant)
'
' make sure conditional field is also filled in
'
Dim strMsg As String
'
strMsg = "The [" & MasterName & "] field contains data, " & _
" the [" & ChildName & "] field must also contain valid data"
'
If Len(Trim(ChildValue)) = 0 Then
RaiseEvent ConditionalError(strMsg)
End If
'
End Sub |
|
|
|
|
|